package com.lpl.polo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@NoArgsConstructor
@AllArgsConstructor
@Data
public class result<T> {
    private  Integer code;//1成功，0失败
    private String message;//提示信息
    private T data;//响应数据

    @Override
    public String toString() {
        return "result{" +
                "code=" + code +
                ", message='" + message + '\'' +
                ", data=" + data +
                '}';
    }

    public static <E> result<E> success(E data){
        return new result<>(1,"请求成功！",data);
    }

    public  static  result success(){
        return  new result(1,"请求成功",null);
    }
    public  static  result error(String err){
        return  new result(1,err,null);
    }
}
